<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"> 
    <!--
    Author Lu Xiaodi
    -->
    <h:head> 
        <title>IOTR</title> 

        <style type="text/css"> 

            .gritter-notice-wrapper { 
                left:200px; 
                top:50px; 
            } 
        </style> 

    </h:head> 
    <h:body>                 
        <p:menubar>
            <p:menuitem value="Stakeholder Account and Billing Management" url="/TCubeAdmin/SABM.xhtml" />
            <p:menuitem value="Integrated Online Ticketing and Reservation" url="/TCubeAdmin/IOTR.xhtml" />
            <p:menuitem value="Unified Loyalty Program" url="/TCubeAdmin/ULP.xhtml" />
        </p:menubar>
        <h1>Integrated Online Ticketing and Reservation (IOTR)- TCubeAdmin Portal</h1> 

        <p:layout style="table-layout:auto; height:600px ">
            <p:layoutUnit position="left" header="Navigation" width="300">
                <ez:TCubeAdminIOTRLeftMenu/>
            </p:layoutUnit>
            <p:layoutUnit position="center" header="Settings" scrollable="true">

                <h:form>
                    <p:dataTable id="mealList" var="proposal" value="#{groupBuyingManagedBean.allProposal}" 
                                 emptyMessage="Currently no dishes have been added"
                                 dynamic ="true" paginator="true" paginatorPosition="top" 
                                 rows="20">

                        <f:facet name="header">
                            Existing group buying items
                        </f:facet>

                        <p:column style="width:16px">  
                            <p:rowToggler />  
                        </p:column> 

                        <p:column headerText="id" filterBy="#{proposal.id}">
                            <h:outputText id="id" value="#{proposal.id}" />
                        </p:column>
                        <p:column headerText="Name">
                            <h:outputText id="name" value="#{proposal.name}" />
                        </p:column>
                        <p:column headerText="Stakeholder" filterBy="#{proposal.stakeholder.name}">
                            <h:outputText id="stakeholder" value="#{proposal.stakeholder.name}" />
                        </p:column>
                        <p:column headerText="Submission Time" filterBy="#{proposal.submissionTime}">
                            <h:outputText id="dos" value="#{proposal.submissionTime}"/> 
                        </p:column>
                        <p:column headerText="Status" filterBy="#{proposal.status}">
                            <h:outputText id="status" value="#{proposal.status}" />
                        </p:column>
                        <p:column headerText="Options">
                            <p:commandButton id="approve" value="Approve" ajax="false"
                                             update="display" disabled="#{proposal.status eq 'pending' ? false:true}"
                                             actionListener="#{groupBuyingManagedBean.approveProposal}">
                                <f:attribute name="gbItemId" value="#{proposal.id}" />
                            </p:commandButton>
                            <p:commandButton id="deny" value="Deny" ajax="false"
                                             actionListener="#{groupBuyingManagedBean.denyProposal}"
                                             update="display" disabled="#{proposal.status eq 'pending' ? false:true}">
                                <f:attribute name="gbItemId" value="#{proposal.id}" />
                            </p:commandButton>
                        </p:column>


                        <p:rowExpansion>  
                            <h:panelGrid id="display" columns="2" cellpadding="4"  
                                         style="width:900px;"  
                                         styleClass="ui-widget-content"  
                                         columnClasses="label, value">
                                <f:facet name="header">  
                                    More information...
                                </f:facet>  

                                <h:outputText value="Offering Price: "/>
                                <h:outputText id="offeringPrice" value="#{proposal.offeredPrice}"/>
                                <h:outputText value="Original Price: "/>
                                <h:outputText id="originalPrice" value="#{proposal.originalPrice}"/>
                                <h:outputText value="Effective start: "/>
                                <h:outputText id="effectiveStart" value="#{proposal.effectiveStart}"/>
                                <h:outputText value="Effective start: "/>
                                <h:outputText id="effectiveEnd" value="#{proposal.effectiveEnd}"/>
                                <h:outputText value="Redemption start: "/>
                                <h:outputText id="redemptionStart" value="#{proposal.redemptionStart}"/>
                                <h:outputText value="Redemption end: "/>
                                <h:outputText id="redemptionEnd" value="#{proposal.redemptionEnd}"/>
                                <h:outputText value="Min Quota: "/>
                                <h:outputText id="minQuota" value="#{proposal.minQuota}"/>
                                <h:outputText value="Max quota: "/>
                                <h:outputText id="maxQuota" value="#{proposal.maxQuota}"/>
                                <h:outputText value="Personal quota: "/>
                                <h:outputText id="personalQuota" value="#{proposal.personalQuota}"/>
                                <h:outputText value="Require booking: "/>
                                <h:outputText id="reqBooking" value="#{proposal.requireBooking}"/>
                                <h:outputText value="Description"/>
                                <h:outputText id="description" value="#{proposal.description}"/>
                                <h:outputText value="Validation"/>
                                <h:outputText id="validation" value="#{proposal.validateRequirements}"/>
                            </h:panelGrid>

                            <br/>
                        </p:rowExpansion>
                    </p:dataTable>
                </h:form>
            </p:layoutUnit>
        </p:layout>

    </h:body> 
</html>